<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width" />
    <title>Media Chrome &lt;mux-video&gt; Example</title>
    <script type="module" src="../../../dist/index.js"></script>
    <script type="module" src="https://cdn.jsdelivr.net/npm/@mux/mux-video/+esm"></script>
    <style>
      /** add styles to prevent CLS (Cumulative Layout Shift) */
      media-controller:not([audio]) {
        display: grid;          /* expands the container if preload=none */
        max-width: 800px;       /* allows the container to shrink if small */
        aspect-ratio: 16 / 9;   /* set container aspect ratio if preload=none */
        width: calc(100vmax - (8px * 2));
      }

      @media (min-width: 768px) {
        media-controller:not([audio]) {
          width: 50vw;
        }
      }

      mux-video {
        width: 100%;
      }

      media-audio-track-menu[mediaaudiotrackunavailable],
      media-audio-track-menu-button[mediaaudiotrackunavailable],
      media-rendition-menu[mediarenditionunavailable],
      media-rendition-menu-button[mediarenditionunavailable],
      media-fullscreen-button[mediafullscreenunavailable],
      media-airplay-button[mediaairplayunavailable],
      media-cast-button[mediacastunavailable],
      media-pip-button[mediapipunavailable] {
        display: none;
      }

      media-settings-menu-item[aria-haspopup]:is(
        :not([submenusize]),
        [submenusize="0"],
        [submenusize="1"]
      ) {
        display: none;
      }

      .examples {
        margin-top: 20px;
      }
    </style>
  </head>
  <body>
    <main>
      <h1>Media Chrome <code>&lt;mux-video&gt;</code> Example</h1>
      <media-controller defaultsubtitles>
        <mux-video
          slot="media"
          crossorigin
          playsinline
          preload="metadata"
          playback-id="Sc89iWAyNkhJ3P1rQ02nrEdCFTnfT01CZ2KmaEcxXfB008"
          muted
        >
          <track
            label="thumbnails"
            default
            kind="metadata"
            src="https://image.mux.com/Sc89iWAyNkhJ3P1rQ02nrEdCFTnfT01CZ2KmaEcxXfB008/storyboard.vtt"
          />
        </mux-video>
        <media-audio-track-menu anchor="auto" hidden>
          <div slot="header">Audio</div>
        </media-audio-track-menu>
        <media-rendition-menu anchor="auto" hidden>
          <div slot="header">Quality</div>
        </media-rendition-menu>
        <media-playback-rate-menu anchor="auto" hidden>
          <div slot="header">Playback Rate</div>
        </media-playback-rate-menu>
        <media-captions-menu anchor="auto" hidden>
          <div slot="header">Subtitles</div>
        </media-captions-menu>
        <media-control-bar>
          <media-play-button></media-play-button>
          <media-seek-backward-button></media-seek-backward-button>
          <media-seek-forward-button></media-seek-forward-button>
          <media-mute-button></media-mute-button>
          <media-volume-range></media-volume-range>
          <media-time-range></media-time-range>
          <media-time-display showduration></media-time-display>
          <media-audio-track-menu-button></media-audio-track-menu-button>
          <media-rendition-menu-button></media-rendition-menu-button>
          <media-captions-menu-button></media-captions-menu-button>
          <media-playback-rate-menu-button></media-playback-rate-menu-button>
          <media-pip-button></media-pip-button>
          <media-fullscreen-button></media-fullscreen-button>
        </media-control-bar>
      </media-controller>
      <div class="examples">
        <a href="../">View more examples</a>
      </div>
    </main>
  </body>
</html>
